from typing import Union

from enum import IntEnum
import numpy as np

from osgeo import gdal

# TODO notice gdal.GDT_XXX are not python types
# they are just int value, thus not supported by python's typing system
# need to find another way to specify a generic gdal_numerics

# gdal_numeric = Union[
#     gdal.GDT_Byte,
#     gdal.GDT_Int16,
#     gdal.GDT_UInt16,
#     gdal.GDT_Int32,
#     gdal.GDT_UInt32,
#     gdal.GDT_Float32,
#     gdal.GDT_Float64,
# ]
#


class GDALNumeric(IntEnum):
    Byte = gdal.GDT_Byte
    Int16 = gdal.GDT_Int16
    UInt16 = gdal.GDT_UInt16
    Int32 = gdal.GDT_Int32
    UInt32 = gdal.GDT_UInt32
    Float32 = gdal.GDT_Float32
    Float64 = gdal.GDT_Float64


np_numeric = Union[
    np.uint8, np.int16, np.uint16, np.int16, np.uint32, np.int32, np.float32, np.float64
]

numeric = Union[int, float]
